package com.xzx.shop_front_api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xzx.shop_front_api.entity.Order;
import com.xzx.shop_front_api.entity.OrderItem;
import com.xzx.shop_front_api.mapper.OrderItemMapper;
import com.xzx.shop_front_api.mapper.OrderMapper;
import com.xzx.shop_front_api.service.OrderItemService;
import com.xzx.shop_front_api.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderItemServiceImpl implements OrderItemService {
    @Autowired
    private OrderItemMapper orderItemMapper;

    @Override
    public int insertOrderItem(List<OrderItem> orderItemList) {
        return orderItemMapper.insertOrderItem(orderItemList);
    }

    @Override
    public List<OrderItem> selectOrderItemListByOrderId(Long orderId) {
        QueryWrapper<OrderItem> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("order_id", orderId);
        return orderItemMapper.selectList(queryWrapper);
    }
}
